package com.android.infantschool.model.mvp.presenter;

import com.android.infantschool.bean.BaseBean;
import com.android.infantschool.model.mvp.model.ApiModel;
import com.android.infantschool.model.mvp.model.ApiModelImpl;
import com.android.infantschool.model.mvp.model.OnApiListener;
import com.android.infantschool.model.mvp.view.BabyRemarkView;
import java.util.Map;

/**
 * @author Administrator
 * @particulars
 * @time 2019\7\24 0024 8:54
 * @class describe
 */
public class BabyRemarkPresenterImpl implements BabyRemarkPresenter, OnApiListener {

    private BabyRemarkView babyRemarkView;
    private ApiModel apiModel;

    public BabyRemarkPresenterImpl(BabyRemarkView babyRemarkView) {
        this.babyRemarkView = babyRemarkView;
        this.apiModel = new ApiModelImpl();
    }

    @Override
    public void onDestroy() {
        babyRemarkView = null;
    }

    @Override
    public void getBabyRemark(Map<String, String> map) {
        apiModel.getBabyRemark(this, map);
    }

    @Override
    public void onError(String error) {
        if (babyRemarkView != null) {
            babyRemarkView.errorBabyRemark(error);
        }
    }

    @Override
    public void onSuccess(BaseBean baseBean) {
        if (babyRemarkView != null) {
            babyRemarkView.successBabyRemark(baseBean);
        }
    }

}